package com.alangyun.remind.repository.data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

@XStreamAlias("term")
public class NameTerm implements Serializable {
	@XStreamAlias("id")
	@XStreamAsAttribute
	private int id;
	@XStreamAlias("name")
	@XStreamAsAttribute
	private String text;
	@XStreamAlias("children")
	private List<NameTerm> nodes;

	public static NameTerm create(int index, String text) {
		NameTerm ret = new NameTerm();
		ret.id = index;
		ret.text = text;
		ret.nodes = new ArrayList<>();
		
		return ret;
	}
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getHref() {
		return id+"";
	}
	
	public List<NameTerm> getNodes() {
		return nodes;
	}

	public void setNodes(List<NameTerm> nodes) {
		this.nodes = nodes;
	}

}
